package top.liujiachen.springboot.shiro.dao.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import top.liujiachen.springboot.shiro.dao.IGroupDao;
import top.liujiachen.springboot.shiro.entity.SysGroup;
import top.liujiachen.springboot.shiro.mapper.SysGroupMapper;

import java.util.Optional;

@Service
public class GroupDao extends ServiceImpl<SysGroupMapper, SysGroup> implements IGroupDao {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public SysGroup getById(Long id) {
        SysGroup sysGroup = null;
        if (Optional.ofNullable(id).isPresent()) {
            try {
                sysGroup = getById(id);
            } catch (Exception e) {
                logger.error("MyBatis-Plus Error: ", e);
            }
        }
        return sysGroup;
    }

}
